package com.lh.filter;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * 过滤器实现方法一
 * 注解：@WebFilter申明此类为过滤器配置类,urlPatterns过滤请求的路径
 * 配合@ServletComponentScan使用
 * @Author LuoHang
 * @Date 2022-05-10 18:15
 **/
@WebFilter(urlPatterns = {"/myServlet01"})
public class MyFilter01 implements Filter {
    public static final Logger logger = LoggerFactory.getLogger(MyFilter01.class);

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        logger.info("MyFilter01.doFilter()方法执行.........");
        filterChain.doFilter(servletRequest,servletResponse);
    }
}
